<script setup lang="ts">
import {message} from "ant-design-vue";

// 批量优化计划按钮
import KeywordOptimizationPlan
  from "~/contentScripts/views/wxt/SuperOptimization/KeywordPromotion/KeywordOptimizationPlan.vue";
import WxtModal from "~/contentScripts/views/wxt/wxt-modal.vue";

const props = defineProps({
  rows: {
    type: Array,
    default: () => []
  }
});
const visible = ref(false);
const handle = () => {
  if (props.rows.length === 0) {
    message.error('请选择需要批量处理的数据！');
    return;
  }
  visible.value = true;
}
</script>

<template>
  <slot>
    <a-button size="small" type="primary" @click="handle">批量优化计划</a-button>
  </slot>
  <wxt-modal v-model:visible="visible" title="批量优化计划" width="95%" @cancel="visible=false">
    <KeywordOptimizationPlan :campaignIds="rows.map((row)=>{
      return row.campaignId;
    })"
    />
  </wxt-modal>
</template>

<style scoped>

</style>
